using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
using WLYT.Admin.WebApi.Models;
using WLYT.Application.Interfaces;
using WLYT.Domain.Model;

namespace WLYT.Admin.WebApi.Controllers
{
    [System.Web.Http.Description.ApiExplorerSettings(IgnoreApi = true)]
    public class OrderItemDetailController : BaseController
    {
        private readonly IOrderItemDetailService OrderItemDetailService;

        public OrderItemDetailController(IOrderItemDetailService orderItemDetailService)
        {
            OrderItemDetailService = orderItemDetailService;
        }

        [HttpGet]
        [Route("api/OrderItemDetail/GetData")]
        public async Task<Table<OrderItemDetail>> GetData(int type, string docType, int? status, string docNum, string labelId, int pageSize, int pageIndex)
        {
            var response = await OrderItemDetailService.GetModelsByPageAsync(type, docType, status, docNum, labelId, pageSize, pageIndex);
            return new Table<OrderItemDetail>(response.Item1, response.Item2);
        }
    }
}